var _showHot = {
	curPage:1,				//当前标签
	picNum:0,
	waitTime:4000,			//自动播放间隔时间
	tarDiv:null,			//目标层
	imgListObj:[],			//存放数据数组
	autoItv:null,			//自动播放计数	跳转时计数器
	tarShowDiv:null,
	tarDescDiv:null,
	
	init:function(divId){
		
		this.tarDivObj = document.getElementById(divId);
		if(!this.tarDivObj)
			return;
			
		var tt1 = this.tarDivObj.getElementsByTagName("LI");
		for(i=0;i<tt1.length;i++){
			var imgObj = tt1[i].getElementsByTagName("IMG");
			var aObj = tt1[i].getElementsByTagName("A");
			var spanObj = tt1[i].getElementsByTagName("span");
			
			if(spanObj.length<1)
				continue;
			if(imgObj.length<1)
				continue;
			if(aObj.length<2)
				continue;
		
			this.imgListObj[i] = {
				"src" : imgObj[0].src,
				"alt" : imgObj[0].alt,
				"href" : aObj[0].href,
				"h2" : '<a target="_blank" href="'+aObj[1].href+'">'+aObj[1].innerHTML+'</a>',
				"h3" : spanObj[0].innerHTML
			};
		}
		
		
		if(this.imgListObj.length<1){
			return false;
		}
		this.picNum = this.imgListObj.length;
		
		if(this.curPage<1 || this.curPage>this.picNum){
			this.curPage = 1;	
		}
		
		var tempString  = "";
			tempString += '<div class="slide_img" id="slide_img">';
			tempString += '<a href="'+this.imgListObj[this.curPage-1]["href"]+'" target="_blank" title="'+this.imgListObj[this.curPage-1]["alt"]+'">';
			tempString += '<img src="'+this.imgListObj[this.curPage-1]["src"]+'" style="filter:revealTrans(Transition=1,Duration=0.9);" />';
			tempString += '</a>';
			tempString += '<div>';

			for(var i=0; i<this.picNum; i++){
				tempString += '<a href="javascript:_showHot.over_in('+(i+1)+')" class="' + ((i+1)==this.curPage?'slide_tag2':'slide_tag1') + '">'+(i*1+1)+"</a>";
			}
			tempString += '</div>';
			tempString += '</div>';
			
			tempString += '<div class="slide_text" id="slide_text">';
			tempString += '<h1>';
			tempString += this.imgListObj[this.curPage-1]["h2"];
			tempString += '</h1>';
			tempString += this.imgListObj[this.curPage-1]["h3"];
			tempString += '</div>';
		
		document.write(tempString);

		this.tarShowDiv = document.getElementById("slide_img");
		this.tarDescDiv = document.getElementById("slide_text");

		if(!this.tarShowDiv || !this.tarDescDiv) 
			return;

		this.over_start();					
		return;
	},
	autoSlide:function(){
		if(this.curPage < this.picNum){
			this.curPage++;
		}else{
			this.curPage=1;
		}
		this.slideTo();
		return;
	},
	slideTo:function(){
		this.over_stop();
		if(!this.tarShowDiv || !this.tarDescDiv) 
			return;
		if(this.curPage>this.picNum)
			return;
			
			
		var tempString  = '';
			tempString += '<h1>';
			tempString += this.imgListObj[this.curPage-1]["h2"];
			tempString += '</h1>';
			tempString += this.imgListObj[this.curPage-1]["h3"];
			
		this.tarDescDiv.innerHTML = tempString;
			
			
		var tempAObjArray = this.tarShowDiv.getElementsByTagName("a");
		var tempAObj = tempAObjArray[0];
		var tempImgObj = this.tarShowDiv.getElementsByTagName("img")[0];
		tempImgObj.alt = this.imgListObj[this.curPage-1]["alt"];
		try{
			tempImgObj.filters.item(0).transition = 12;
			tempImgObj.filters.item(0).Apply();
			tempImgObj.src = this.imgListObj[this.curPage-1]["src"];
			tempImgObj.filters.item(0).Play();
		}catch(e){
			tempImgObj.src = this.imgListObj[this.curPage-1]["src"];
		}
		tempAObj.href = this.imgListObj[this.curPage-1]["href"];		

		for(var i=1; i<tempAObjArray.length; i++){
			if(i==this.curPage){
				tempAObjArray[i].className = "slide_tag2";
			}else{
				tempAObjArray[i].className = "slide_tag1";				
			}
		}
		this.over_start();					
		return;
	},
	over_in:function(n){
		this.curPage = n;
		this.slideTo();
		return;
	},		
	over_start:function(){
		this.autoItv = setInterval( function(){
			_showHot.autoSlide();
		}, this.waitTime );	
		return;
	},
	over_stop:function(){
		clearInterval(this.autoItv);
		return;
	}
};